/**
 * @author: wq
 * @Date: 2017/8/18
 * @Time: 14:43
 * <p>
 * Description:
 *          ***
 */
import axios from 'axios';
import { API_NEW_VERSION, ALL_SERVICE_API } from '../api';

var qs = require('qs');

/**
 * 保存网点管理
 * @param params
 * @returns {AxiosPromise}
 */
export const saveNetworkManagement = params => {
  return axios.post(ALL_SERVICE_API + '/net-works', params);
};

/**
 * 获取网点管理列表
 * @param params
 * @returns {AxiosPromise}
 */
export const searchNetworkManagements = params => {
  return axios.get(ALL_SERVICE_API + '/net-works', {params: params});
};

/**
 * 删除网点管理
 * @param params
 * @returns {AxiosPromise}
 */
export const deleteNetworkManagement = id => {
  return axios.delete(ALL_SERVICE_API + '/net-works/' + id);
};

/**
 * 获取网点管理
 * @param id
 * @returns {AxiosPromise}
 */
export const findNetworkManagement = id => {
  return axios.get(ALL_SERVICE_API + '/net-works/' + id);
};

/**
 * 修改网点管理状态
 * @param id
 * @returns {AxiosPromise}
 */
export const changeStatus = (id, status) => {
  return axios.post(ALL_SERVICE_API + '/net-works/change', qs.stringify({id: id, status: status}));
};

/**
 * 根据省市县检索附近的网点
 * @param params
 * @returns {AxiosPromise}
 */
export const search = (params) => {
  return axios.get(API_NEW_VERSION + 'net_work_managements_addresses', {params: params});
};
/**
 * 网点导出
 * @param params
 * @returns {AxiosPromise}
 */
export const networkExport = params => {
  axios.get(ALL_SERVICE_API + '/net-works/export', {params: params});
};
